﻿
@{
    ViewData["Title"] = "Index";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<link href="~/content/jq/jqx.base.css" rel="stylesheet" />
<link href="~/content/jq/jqSplitter/jqx.bootstrap.css" rel="stylesheet" />
<script src="~/content/jq/jqxcore.js"></script>
<script src="~/content/jq/jqSplitter/jqxsplitter.js"></script>

@using Microsoft.AspNetCore.Mvc.Localization
@inject IHtmlLocalizer<SharedResources> SharedLocalizer

<div id="appModel" style="text-align: center;">

    <div style="width:99.5%;display: inline-block;text-align: left;">

        <!--多行条件-->
        @*<div class="topPanel">
                <div class="search">
                    <table>
                        <tr>
                            <td>
                                <div class="input-group">
                                    <input id="txt_keyword" type="text" class="form-control" placeholder="@SharedLocalizer["KeyPlaceHolder"]" style="width: 260px;" v-model="queryKey">

                                    <span class="input-group-btn">
                                        <button id="btn_search" type="button" class="btn  btn-primary-blue" v-on:click="search"><i class="fa fa-search"></i></button>
                                    </span>


                                </div>
                            </td>
                        </tr>
                    </table>
                </div>
            </div>*@

        <!--单行条件-->
        <div class="panel panel-default">
            <div class="panel-heading">查询条件</div>
            <div class="panel-body">
                <div class="input-group">
                    <input id="txt_keyword" type="text" class="form-control" placeholder="@SharedLocalizer["KeyPlaceHolder"]" style="width: 260px;" v-model="queryKey">
                    <span class="input-group-btn">
                        <button id="btn_search" type="button" class="btn  btn-primary-blue" v-on:click="search"><i class="fa fa-search"></i>查询</button>
                    </span>


                </div>
            </div>

        </div>

        <div id="toolbar">
            <div class="btn-group">
                @*<a class="btn btn-default" onclick="$dh.reload()"><span class="glyphicon glyphicon-refresh"></span></a>
                <button class="btn btn-default" v-bind:disabled="!selectedData" v-on:click="edit"><i class="fa fa-pencil-square-o"></i>@SharedLocalizer["Update"]</button>
                <button class="btn btn-default" v-bind:disabled="!selectedData" v-on:click="del"><i class="fa fa-trash-o"></i>@SharedLocalizer["Delete"]</button>
                <button class="btn btn-default" v-on:click="add"><i class="fa fa-plus"></i>@SharedLocalizer["Add"]</button>
                &nbsp;
                <button class="btn btn-default" v-bind:disabled="!selectedData" onclick="_vmBase.roleAuthorityAssign();"><i class="fa fa-key"></i>@SharedLocalizer["RoleAuthority"]</button>
                <button class="btn btn-default" v-bind:disabled="!selectedData" onclick="_vmBase.roleMenusAssign();"><i class="glyphicon glyphicon-th-list"></i>@SharedLocalizer["RoleMenu"]</button>
                <button class="btn btn-default" v-bind:disabled="!selectedData" onclick="_vmBase.roleUsersAssign();"><i class="fa fa-users"></i>@SharedLocalizer["RoleUsers"]</button>*@
                @await Html.PartialAsync("_Partical_Button")
            </div>

        </div>

        <div class="table-responsive" style="width:100%">
            <table class="table table-no-bordered " id="tb_roles"></table>
        </div>

        <modal-dialog v-show="showDialog" :title="modalTitle" :entity="entityObj" :btnclose="btnClose" :btnsubmit="btnSubmit">
            <div slot="modal-body">

                <form id="form1">
                    <div style="margin-top: 10px; margin-left: 10px; margin-right: 10px;">
                        <div style=" margin-right: 30px;">
                            <table class="form">

                                <tr>
                                    <td class="formTitle">名称</td>
                                    <td class="formValue">
                                        <input id="account" name="account" type="text" class="form-control required" placeholder="请输入名称" v-model="entityObj.Name" />
                                    </td>

                                </tr>
                                <tr>
                                    <td class="formTitle">状态</td>
                                    <td class="formValue">
                                        <input type="radio" id="one" value="true" v-model="entityObj.Status">
                                        <label for="one">启用</label>
                                        <input type="radio" id="two" value="false" v-model="entityObj.Status">
                                        <label for="two">禁用</label>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="formTitle">所属范围</td>
                                    <td>
                                        <input id="RoleRangeName" type="text" class="form-control" v-model="entityObj.RoleRangeName" />
                                        <input id="RoleRange" type="hidden" class="form-control" v-model="entityObj.RoleRange" />
                                        <div id="menuContent" class="menuContent" style="display: none;">
                                            <ul id="roleOrg" class="ztree"></ul>
                                        </div>
                                    </td>
                                </tr>
                            </table>
                        </div>
                    </div>
                </form>
            </div>

        </modal-dialog>


    </div>

</div>

<!--角色分配权限-->
<div id="roleAuthorityDiv" style="display: none">

    <div id="roleAuthorityMainSplitter">
        <div id="roleAuthorityResource">
            
            <table class="table table-no-bordered " id="tb_roleAuthority"></table>
        </div>
        <div id="roleAuthorityResButton">
            <div id="resourceToolBar">
                <div class="btn-group">
                    <button class="btn btn-default"  onclick="_vmBase.submitResourceAuthority();"><i class="fa fa-check"></i>保存</button>
                </div>
            </div>
            <table class="table table-no-bordered " id="tb_resourceFuncs"></table>
        </div>
    </div>


    @*<table class="table table-no-bordered " id="tb_roleAuthority"></table>*@
</div>

<!--角色菜单分配-->
  <div id="roleMenusDiv" style="display:none">
      @*<div class="btn-group">
          <button class="btn btn-default" ><i class="fa fa-check"></i>保存</button>
      </div>*@
      <ul id="roleMenuTree" class="ztree"></ul>
  </div>

<!--角色用户-->
<div id="roleUsersDiv" style="display:none">
    <div id="roleUserToolBar">
        <div class="btn-group">
            <button class="btn btn-default" onclick="_vmBase.searchUsers();"><i class="fa fa-plus">添加用户</i></button>
            <button class="btn btn-default" onclick="_vmBase.deleteRoleUsers();"><i class="fa fa-trash-o">删除</i></button>
        </div>
    </div>

    <div class="table-responsive" style="width:100%">
        <table class="table table-no-bordered " id="tb_roleUsers"></table>
    </div>
</div>


<!--启用 filter 功能-->
<link href="~/lib/bootstrap-table/src/extensions/filter-control/bootstrap-table-filter-control.css" rel="stylesheet" />
<script src="~/lib/bootstrap-table/src/extensions/filter-control/bootstrap-table-filter-control.js"></script>


@this.RefScript("~/content/js/base.js")
<script type="text/javascript">
    var _getTreeDataUrl = "@this.Href("~/Organize/TreeData")";
    var _getTableListUrl = "@this.Href("~/Role/Roles")";
    var _updateModelUrl = "@this.Href("~/Role/Add")";
    var _deleteModelUrl = "@this.Href("~/Role/Delete")";
    var _enabledRoleUrl = "@this.Href("~/Role/EnableRole")";
    var _disabledRoleUrl = "@this.Href("~/Role/DisAbleRole")";
    var _getRoleResourcesUrl = "@this.Href("~/Category/GetResources")";
    var _getButtonsUrl = "@this.Href("~/Button/GetButtons")";
    var _getFuncsUrl = "@this.Href("~/Features/GetFuncs")"; //获取功能集
    var _getResourceFuncsUrl = "@this.Href("~/Features/GetFeaturesFuncs")";//获取资源功能
    var _saveRolePrivilegeUrl = "@this.Href("~/Role/SaveRolePrivilege")"; //保存角色权限
    var _getRolePrivilegeUrl = "@this.Href("~/Role/GetRolePrivilege")";//获得角色权限
    var _getMenuTreeUrl = "@this.Href("~/Menu/GetMenuTree")"; //获取菜单
    var _saveRoleMenusUrl = "@this.Href("~/Role/SaveRoleMenus")";//保存角色菜单
    var _getRoleMenusUrl = "@this.Href("~/Role/GetRoleMenus")";//获取角色菜单
    var _getRoleUsersUrl = "@this.Href("~/Role/GetRoleUsers")";//获取角色用户
    var _saveRoleUsersUrl = "@this.Href("~/Role/SaveRoleUsers")";//存储角色用户
    var _deleteRoleUserUrl = "@this.Href("~/Role/DeleteRoleUsers")";//删除角色用户

    var _deleteRemand = "@SharedLocalizer["DeleteConfirm"]";
    var _enabledStr = "@SharedLocalizer["Enabled"]";
    var _disabledStr = "@SharedLocalizer["Disabled"]";

    var _rolePrivilgeStr = "@SharedLocalizer["RoleAuthority"]";
    var _roleMenuStr = "@SharedLocalizer["RoleMenu"]";
    var _roleUserStr = "@SharedLocalizer["RoleUsers"]";

    var _roleMenuLayerIndex;
    var _roleUsersLayerIndex;


    var _isEnabledSelect = {
        "true": "启用",
        "false": "禁用"

    };


    var _roleOrgTree;

</script>
<script src="~/js/Utility/userSearch.js"></script>
@*<script src="~/js/Utility/dhUsers.js"></script>*@
<script src="~/js/Views/Role/Index.js"></script>

